package com.koron.css2.serviceManage.impl;

import com.koron.common.bean.StaffBean;
import com.koron.css2.ServerInterface;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * 
 * @author 59532
 *
 */
public class OrgStaffUpdate implements ServerInterface{

	private static Logger logger = LogManager.getLogger(OrgStaffUpdate.class);

	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		MessageBean<Void> message = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "success", Void.class);
		try {
			StaffBean staff = JsonUtils.objectToPojo(req.getData(), StaffBean.class);
			if(StringUtils.isEmpty(staff.getName())) {
				message.setCode(Constant.MESSAGE_INT_FAIL);
				message.setDescription("参数不能为空");
				return message;
			}
			if(StringUtils.isEmpty(staff.getLoginid())) {
				message.setCode(Constant.MESSAGE_INT_FAIL);
				message.setDescription("参数不能为空");
				return message;
			}
			if(StringUtils.isEmpty(staff.getLoginid())) {
				message.setCode(Constant.MESSAGE_INT_FAIL);
				message.setDescription("参数不能为空");
				return message;
			}
			//List<StaffBean> staffs = mapper.selectList(param);
			//message.setData(new PageInfo<StaffBean>(staffs));
		} catch (Exception e) {
			logger.error("非法参数", e);
			return MessageBean.create(Constant.ILLEGAL_PARAMETER, "非法参数", void.class);
		}
		return message;
	}

}
